package com.chapter14.demo3;

import java.util.Arrays;
import java.util.List;

/**
 * 查找与匹配
 */
public class FindAndMathStream {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("a", "b", "c", "d");
        System.out.println(list.stream().findFirst().get());

        System.out.println(list.stream().findAny().get());

        System.out.println(list.stream().allMatch(x->x.equals("a")));

        System.out.println(list.stream().anyMatch(x->x.equals("a")));

        System.out.println(list.stream().noneMatch(x->x.equals("a")));

    }
}
